Motion Fencing

ABSTRACT

In some implementations, a mobile device can be configured with virtual motion fences that delineate domains of motion detectable by the mobile device. In some implementations, the mobile device can be configured to invoke an application or function when the mobile device enters or exits a motion domain (by crossing a motion fence). In some implementations, entering or exiting a motion domain can cause components of the mobile device to power on or off (or awaken or sleep) in an incremental manner.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of and claims priority to U.S. patentapplication Ser. No. 13/913,234, entitled “Motion Fencing,” filed Jun.7, 2013, the entire contents of which is incorporated herein byreference.

TECHNICAL FIELD

The disclosure generally relates to power management for mobile devices.

BACKGROUND

Modern mobile devices often include sensors for detecting motion of themobile device. For example, mobile devices can include accelerometersand/or gyroscopes for detecting motion and determining orientation ofthe mobile device. Some mobile devices can be configured to dynamicallyadjust functionality, features, user interfaces and/or operations of themobile device based on detected motion.

SUMMARY

In some implementations, a mobile device can be configured with virtualmotion fences that delineate domains of motion detectable by the mobiledevice. In some implementations, the mobile device can be configured toinvoke an application or function when the mobile device has entered orexited a motion domain (by crossing a motion fence). In someimplementations, entering or exiting a motion domain can causecomponents of the mobile device to power on or off (or awaken or sleep)in an incremental manner.

Particular implementations provide at least the following advantages:Motion fencing provides an easy way to classify motion detected by themobile device and trigger applications, functions, alerts and/or otheroperations of the mobile device based on the class. Using motion fencesto gradually start, stop or wake up components, sensors,microcontrollers and other processors of the mobile device allows themobile device to conserve energy while enabling the functionality neededto process motion measurements.

Details of one or more implementations are set forth in the accompanyingdrawings and the description below. Other features, aspects, andpotential advantages will be apparent from the description and drawings,and from the claims.

DESCRIPTION OF DRAWINGS

FIG. 1 illustrates example categories of motion fences.

FIG. 2 illustrates an example correlation between motion fences and realworld motion.

FIG. 3 is a block diagram of an example motion fencing system.

FIG. 4 is flow diagram of an example motion fencing process.

FIG. 5 is a block diagram illustrating an example API architecture,which can be used in some implementations.

FIG. 6 illustrates an example software stack that includes variousapplication programming interfaces.

FIG. 7 is a block diagram of an exemplary system architectureimplementing the features and processes of FIGS. 1-6.

Like reference symbols in the various drawings indicate like elements.

DETAILED DESCRIPTION Overview

For mobile devices, motion can be a key predictor of a user's desire forinteraction. Motion can also be an indicator of activities that are ofinterest to the user. Motion fences provide a mechanism to anticipateand realize user needs with minimal power impact. In someimplementations, motion fences establish envelopes around distinctmotion domains that are characterized by features of a motion signal ormotion measurements. Motion domains, as delineated by motion fences, cancorrespond to qualitatively different motion profiles. The motion of themobile device can cause the mobile device to cross over a motion fence.Crossing a motion fence can cause the mobile device to triggermotion-based alerts, service wakes, invocations of applications and/orfunctions, and/or a request for additional motion analysis.

FIG. 1 illustrates example motion domains and motion fences. In someimplementations, a mobile device can be configured with motion fences.For example, a motion fence can be defined by motion criteria. For somemotion fences the motion criteria can be based on basic motionmeasurements, such as frequency of motion or magnitude of motion. Forsome motion fences the motion criteria can be based on how long themotion is detected (e.g., for how much time) and/or whether the motioncan be identified or correlated to a real world cause of the motion.

In some implementations, each motion fence can be used to delineatemotion domains. For example, in FIG. 1, each dashed line can represent amotion fence. The area between each dotted line or outside the dottedlines represents a motion domain. For example, motion domain 102 can bea “static” domain. A mobile device can be in the “static” domain whenthe device is motionless or near motionless. Motion domain 104 can be a“sparse motion” domain. A mobile device can be in the “sparse motion”domain when the mobile device detects a small motion. The dashed linebetween motion domain 102 and motion domain 104 is the motion fence 112between the static domain and the sparse motion domain. Motion fence 112can be associated with motion criteria that define when the mobiledevice has crossed from static domain 102 into sparse domain 104. Forexample, the motion criteria for motion fence 112 can define that anymotion above a threshold value (e.g., magnitude) will cause the mobiledevice to cross motion fence 112 from the static domain 102 into thesparse domain 104.

In some implementations, motion fence 114 can be associated with motioncriteria that define when the mobile device crosses from sparse domain104 into “sustained motion” domain 106. For example, the motion criteriafor motion fence 114 can define that motion that has been sustained fora period of time can cause the mobile device to cross motion fence 114from the sparse domain 104 into the sustained motion domain 106. Forexample, an increase in the magnitude and/or frequency of motion forlonger than a threshold a period of time can cause the mobile device totransition from sparse domain 104 into the sustained domain 106.

In some implementations, motion fence 116 can be associated with motioncriteria that define when the mobile device crosses from sustainedmotion domain 106 into “rich motion” domain 108. For example, the motioncriteria for motion fence 116 can define that motion that exceeds athreshold magnitude and/or a threshold frequency for longer than athreshold period of time can cause the mobile device to cross motionfence 116 from the sustained motion domain into the rich motion domain.Thus, the sustained motion domain 106 can correspond to a shortduration, high magnitude motion or a long duration, high frequencymotion while the rich motion domain 108 can correspond to highmagnitude, high frequency motion for a long duration.

In some implementations, entering or exiting a motion domain or crossinga motion fence can trigger an operation of the mobile device. In someimplementations, motion fences and motion domains can be used to triggerstart up of system services when the device is picked up to minimizeuser perceived latency. Motion fences can trigger modulation of cellularand WiFi scanning frequencies based on patterns of motion to optimizepower versus performance. For example, if the device is static (notmoving), the frequency of cellular and WiFi scanning can be reduced toconserve battery power because the cellular and/or WiFi environment isunlikely to change. Motion fences can be used to start counting steps asa user begins walking or running. Motion fences can be used to providecontext (e.g., is the user walking, driving, running, biking, etc.) formap routing or map search results.

In some implementations, crossing a particular motion fence in aparticular direction can trigger an operation of the mobile device. Forexample, a transition 118 from motion domain 104 to motion domain 106can trigger a particular operation of the mobile device while atransition from motion domain 106 to motion domain 104 can trigger adifferent operation of the mobile device even though both transitionscrossed the same motion fence 114. For example, transitioning fromsparse motion domain 104 to sustained motion domain 106 can indicatethat the user has picked up and is looking at the mobile device and thatthe mobile device should start up system services or frequently usedapplications on the mobile device. Transitioning from sustained motiondomain 106 to sparse motion domain 104 can indicate that the user hasplaced the mobile device in a pocket or on the user's lap and that themobile device should shut down or reduce the power to some components ofthe mobile device.

FIG. 2 illustrates an example system 200 for registering a motionfencing client for an activity of interest. For example, a client 202can register with motion fencing system 206 to be notified when themobile device enters a motion domain or crosses a motion fence. In someimplementations, client 202 can request to be notified when a mobiledevice enters a motion domain or crosses a motion fence. For example,client 202 can be an application, function, utility or other componentof the mobile device.

In some implementations, client 202 can send a request 204 to motionfencing system 206 indicating a type of activity that the client 202 isinterested in. For example, the activity could be that the user haspicked up the mobile device. The activity could be that the user iswalking, driving or running. The activity can be any type of activitythat can be identified based on one or more patterns of motion detectedby the mobile device.

In some implementations, motion fencing system 206 can add 208 a clientidentifier and the specified activity of interest to a registry 209. Forexample, motion fencing system 206 can be a system or subsystem of themobile device. Motion fencing system 206 can maintain a lookup table inregistry 209 that maps client identifiers to activities of interestreceived from clients on the mobile device. The registry 209 can be usedto determine which clients are interested in different activities ortypes of motion observed or measured by the mobile device.

In some implementations, motion fencing system 206 can determine amotion domain 210 that corresponds to the activity that the client isinterested in. For example, if the activity is “running,” the motionfencing system 206 can categorize running as a “rich” motion activityand map the running activity to the rich motion domain (e.g., richmotion domain 108 of FIG. 1). If the requested activity is “picked up,”the motion fencing system 206 can categorize “picked up” as sustainedmotion activity and map the running activity to the sustained motiondomain (e.g., sustained motion domain 106 of FIG. 1). If the requestedactivity is “viewing,” the motion fencing system 206 can categorize“viewing” as a transition (e.g., crossing a motion fence in a specificdirection) from the sustained motion domain to the rich motion domain.

In some implementations, motion fencing system 206 can measure themotion of the mobile device 211. For example, the mobile device 211 canbe configured with one or more motion sensors (e.g., accelerometer,gyroscope, etc.) that can measure the motion of the mobile device. Themotion sensors can generate motion signals 213 (e.g., measurements) thatcan be analyzed to determine, for example, changes in the magnitude andfrequency of the signals generated by the motion sensors. The motionsignals can be analyzed over time to determine patterns of motion thatcorrespond to different activities.

In some implementations, the motion fencing system 206 can determine amotion domain 214 based on the motion signals 213. For example, motionfencing system 206 can be configured with motion fences that boundmotion domains. The motion fences can be defined in terms of thresholdsof motion and/or motion criteria that separates each motion domain. Forexample, a motion fence that bounds the “static” motion domain andseparates the static motion domain from the “sparse” motion domain canbe defined by any detected motion that exceeds a threshold magnitudeand/or threshold frequency. The threshold magnitude and/or thresholdfrequency can be very small so that any motion of the device from astationary position will cross the motion fence. This thresholdcomparison can be based on raw or unprocessed motion data (e.g.,unprocessed motion signal). In some implementations, the motion fencescan be defined in terms of more complex motion data that is derived froma motion signal. For example, motion fences can be defined in terms oftransformations (e.g., Fourier transformations, signal filtering, etc.)performed on motion signals and/or patterns of motion observed in motionsignals.

In some implementations, the motion fences can be defined to createmotion domains that cover a variety of different activities that havesimilar motion characteristics. For example, walking and running aredifferent activities that have similar motion signal characteristics andthat might fall within the same motion domain (e.g., rich motiondomain). Thus, a single motion domain, as delineated or constrained bythe motion fences, can correspond to many different types of activities.

In some implementations, once a motion domain is determined 214 based onthe motion signals 213, the motion fencing system 206 can identify anactivity 216 that corresponds to the motion signals 213. For example,the motion signal can include patterns of motion that can be correlatedto various activities. For example, the motion signals 213 can include apattern of motion that correlates to a user walking with the mobiledevice. The motion signal can include a combination of patterns ofmotion. For example, the motion signals 213 can include a pattern ofmotion that correlates to the mobile device 211 being picked up by theuser and another pattern of motion that correlates to the mobile device211 being held in front of the user (e.g., high frequency, low magnitudemotion). In some implementations, the combination of patterns of motioncan correspond to a transition from one motion domain to another motiondomain (e.g., sustained motion domain to rich motion domain). The motionsignals 213 can be analyzed to determine patterns of motion thatindicate that the mobile device is stationary (e.g., on a table), thatthe mobile device is being carried while a user is running, driving, orbiking, for example.

In some implementations, once the motion fencing system 206 hasidentified the activity 216 based on the motion signals 213, the motionfencing system 206 can determine if any client is interested in theidentified activity. For example, motion fencing system 206 canreference the aforementioned lookup table in registry 209 to determinewhich clients are interested in the identified activity. The motionfencing system 206 can then send a notification to the interestedclient(s) indicating that the client's activity of interest has occurred220.

FIG. 3 is a block diagram of an example motion fencing system 300. Forexample, motion fencing system 300 can be a component or subsystem of amobile device. Motion fencing system 300 can be configured to definemultiple motion domains, as described above. In the example system 300,three motion fences and four motion domains are illustrated. Forexample, motion fencing system 300 can include static motion domain 302,sparse motion domain 304, sustained motion domain 306 and rich motiondomain 308. Each motion domain is separated, delineated or bounded by amotion fence, as indicated by the dashed lines between each motiondomain in FIG. 3.

In some implementations, motion fencing system 300 can be used toconserve energy on the mobile device. For example, the mobile device canbe placed into a low power mode when the mobile device is not beingoperated by a user. The user may put the mobile device in the user'spocket, on a table or at some other location that indicates that themobile device should operate in a low power mode. When the mobile deviceis in low power mode some components (e.g., sensors, microcontrollers,memory, processors, etc.) can be turned off or placed in a low poweroperating mode. When the mobile device is in low power mode, somesensors can remain turned on so that a sensor can invoke or turn onother components of the mobile device based on events detected by thepowered on sensor.

In some implementations, motion sensor 310 can be turned on or woke upwhen the mobile device is in a low power operating mode. For example,motion sensor 310 can be an accelerometer, gyroscope, or other type ofmotion sensor. Motion sensor 310 can be configured to detect motion ofthe mobile device and compare the detected motion to threshold motionvalue(s) 312. For example, motion sensor 310 can compare the magnitudeand/or frequency of the detected motion (e.g., motion signal) to thethreshold motion value(s) to determine whether the detected motionexceeds the threshold motion value (e.g., associated with sparse motionfence 342). If the detected motion exceeds the threshold motionvalue(s), then the motion fencing system 300 can transition from staticmotion domain 302 to sparse motion domain 304, for example.

In some implementations, when motion sensor 310 determines that thedetected motion exceeds the threshold motion value 312, motion sensor310 can turn on or wake up low power micro controller 314. For example,the motion fencing system 300 can be configured to turn on or makeavailable additional computing resources as the mobile devicetransitions from a lower motion domain (e.g., static domain 302) to ahigher motion domain (e.g., sparse motion domain 304) to perform morecomplex processing of the motion signal. For example, in addition to thelow power micro controller 314, additional memory resources can be madeavailable to the low power micro controller when the mobile deviceenters the sparse motion domain 304.

In some implementations, low power micro controller 314 can beconfigured to derive a subset of motion features 316 and compare themotion features to motion criteria 318 to determine if the mobile deviceshould move into the sustained motion domain 306. For example, the lowpower micro controller 314 can be configured to process the motionsignal received from the motion sensor to integrate the motion signal(e.g., integrate the accelerometer signal to determine speed) and/ordetermine the amplitude variance of the motion signal. The result ofthis processing can be compared to sparse motion criteria 318 (e.g.,integral and/or variance threshold values) to determine whether themobile device should move into the sustained motion domain 306. Forexample, if the calculated integral value and/or variance value exceedsthreshold values for the integral and/or variance as defined by thesparse motion criteria, then the mobile device can be moved into thesustained motion domain 306.

In some implementations, when low power micro controller 314 determinesthat the derived subset of motion features 316 exceeds the sparse motioncriteria 318 (e.g., associated with the sparse motion fence 342), lowpower micro controller 314 can turn on or wake up high power microcontroller 320. For example, low power micro controller can turn on ortrigger additional computing resources needed to process motion signalsin the sustained motion domain 306 as part of the transition from thesparse motion domain 304 to sustained motion domain 306. Theseadditional computing resources can include high power micro controller320 and/or memory and/or other processors.

In some implementations, high power micro controller 320 can process themotion signal received from motion sensor 310 to derive a full set ofmotion features 322. For example, high power micro controller 320 cantransform the motion signal (e.g., using a Fast Fourier Transform),collect statistics describing the motion signal over time (e.g., 20 or30 seconds) and/or apply filters to the signal to generate a full set ofmotion features 322.

In some implementations, high power microcontroller 320 can analyze thefull set of motion features to identify specific motions of the mobiledevice. For example, the full set of motion features can be compared topatterns of motion associated with known motions (e.g., a flick, tap,bump, etc.) performed by a user with the mobile device. In someimplementations, a client application or function can register to benotified when a specific motion of the mobile device has occurred. Forexample, a client application can register to be notified when a “flick”motion (e.g., a quick directional motion of the mobile device by theuser) has been detected or identified by high power micro controller326. High power micro controller can analyze the motion signal todetermine when the flick motion has occurred and can cause theregistered client application to be notified of the detected motion.

In some implementations, high power micro controller 320 can compare thefull set of motion features with sustained motion criteria 324 todetermine if the mobile device should transition into the rich motiondomain 308. For example, sustained motion criteria can be used to definesustained motion fence 344 and can include frequency patterns that canbe compared to a motion signal that has been transformed using a FastFourier transform or other suitable transform. Sustained motion criteriacan include recurring patterns of motion over time. In someimplementations, if a frequency pattern is observed in the motion signalor recurring pattern of motion is observed in the motion signal, thenthe mobile device can be moved into rich motion domain 308.

In some implementations, when high power micro controller 320 determinesthat the full set of motion features 322 exceeds the sustained motioncriteria (e.g., associated with the sustained motion fence 344), highpower micro controller 320 can turn on main processor 328. For example,high power micro controller 320 can turn on or trigger additionalcomputing resources needed to process motion signals in the rich motiondomain 308 as part of the transition from the sustained motion domain306 to the rich motion domain 308. These additional computing resourcescan include main processor 320 and/or memory and/or other processors.

In some implementations, main processor 328 can analyze the motionsignal received from motion sensor 310, the subset of motion featuresgenerated by low power micro controller 316 and/or the full set ofmotion features generated by high power micro controller 320 to classifythe motion detected by the mobile device into specific activities 330.For example, main processor 328 can analyze the patterns of motion,frequency domain characteristics and/or other signal features todetermine the current activity of a user who is operating or holding(e.g., in hand, pocket, in car, etc.) the mobile device. For example,main processor 328 can analyze the motion signal to determine whetherthe user associated with the mobile device is walking, running, driving,or biking, for example. If the main processor 328 determines that theuser is driving, the main processor 328 can turn on positioning system332 to provide a location of the mobile device, for example. If the useris walking, the main processor 328 can invoke algorithms or functions tocount the steps of the user 334, for example. If a client applicationhas registered with motion fencing system 300 to be notified when theuser is running, the main processor 328 can notify the registered clientthat the user is currently running with the mobile device.

Example Process

FIG. 4 is flow diagram of an example motion fencing process. Forexample, the motion fencing process can be performed by a mobile devicethat has been configured with motion fencing criteria, as describedabove. In some implementations, motion fencing clients within the mobiledevice (e.g., applications, functions, utilities, operating systemfeatures, etc.) can register to get notified when motion correspondingto an activity of interest has occurred. The notification can be in theform of a message, event, invocation or other operation that istriggered based on the activity of interest (e.g., running, biking,driving, etc.) being detected by the motion fencing system of the mobiledevice.

At step 402, the motion of the mobile device can be measured. Forexample, the mobile device can be configured with one or more motionsensors that can measure the motion of the mobile device. The motionsensors can include an accelerometer, gyroscope and/or other types ofmotion sensors. The measured motion can generate a motion signal overtime that indicates the magnitude of the motion at various points intime.

At step 404, the measured motion can be compared to the motion criteriaassociated with a first motion fence. For example, the motion signal canbe compared to motion criteria, such as threshold values for frequency,magnitude, etc. The motion criteria can include thresholds on othermotion measurements derived from the motion signal. The motion criteriacan include patterns of motion (e.g., repeated frequency and ormagnitude patterns) to determine if the motion of the mobile devicefalls within or is outside the first motion fence. For example, theexistence of a pattern of motion (e.g., any pattern of motion) withinthe motion signal can be a criterion by which a motion fence is defined.For example, if there is no pattern within the motion signal, the mobiledevice can remain within the current motion fence. If there is a patternof motion within the motion signal, the mobile device has crossed themotion fence into another motion domain.

At step 406, the mobile device can transition from a first motion domainto a second motion domain based on the comparison. For example, if themotion criteria for the first motion fence has been exceeded (e.g.,threshold values exceeded, types of motion observed), then the mobiledevice can move from the current motion domain across the first motionfence and into a second motion domain.

At step 408, device components for the second motion domain can beturned on or woken from a sleep state. For example, the mobile devicecan start in a low power mode. As the mobile device transitions from thefirst motion domain to the second motion domain, components of themobile device can be turned on (or awakened from a sleep state) toanalyze the motion signals generated by the motion sensor of the mobiledevice. For example, when in the first motion domain, the mobile devicecan be in a low power mode with only the motion sensor turned on. Whenthe mobile device transitions from the first motion domain to the secondmotion domain, the motion sensor can turn on a micro controller toperform additional analysis of the motion signal, as described above.

At step 410, the measured motion can be compared to the motion criteriaassociated with a second motion fence. For example, the second motionfence can be associated with motion criteria that are different than thefirst motion fence. The motion criteria for the second motion fence candescribe more complex types of motion than the first motion fence, forexample. The second motion fence criteria can include patterns ofmotion, values generated from transformations of the motion signal, datagenerated from analysis of the motion signal over time and/or othertypes of motion characteristics.

At step 412, the device can be determined to be within the second motiondomain based on the motion criteria. For example, if the motion signaldoes not meet or exceed the motion criteria for the second motion fence,the mobile device will not cross the second motion fence into anothermotion domain. Thus, the mobile device can be determined to be withinthe second motion domain.

At step 414, an application or function that registered interest in thesecond motion domain or transition can be determined. For example, themotion fencing system can maintain a lookup table that identifiesapplications and/or functions of the mobile device that are interestedin an activity associated with a type of motion and/or motion domain.When it is determined that a mobile device is within a particular motiondomain, the motion fencing system can reference the lookup table todetermine which applications or functions (e.g., motion fencing clients)are interested in the particular motion domain. In some implementations,the motion fencing system can identify particular activities associatedwith the motion domain based on the pattern of motion observed in themotion signal. When an activity is identified based on the motionsignal, the motion fencing system can use the lookup table to determinewhich applications and/or functions are interested in the occurrence ofthe observed activity.

At step 416, the registered application or function can be invoked. Forexample, when the motion fencing system finds an application or functionassociated with the particular motion domain that the mobile device iscurrently within or an identified activity, the application or functioncan be notified that the mobile device is within the motion domain orthat the particular activity is occurring. In some implementations, thenotifying the application or function can include invoking anapplication or function of the mobile device.

Application Programming Interfaces

One or more Application Programming Interfaces (APIs) may be used inimplementations described herein. An API is an interface implemented bya program code component or hardware component (hereinafter“API-implementing component”) that allows a different program codecomponent or hardware component (hereinafter “API-calling component”) toaccess and use one or more functions, methods, procedures, datastructures, classes, and/or other services provided by theAPI-implementing component. An API can define one or more parametersthat are passed between the API-calling component and theAPI-implementing component.

An API allows a developer of an API-calling component (which may be athird party developer) to leverage specified features provided by anAPI-implementing component. There may be one API-calling component orthere may be more than one such component. An API can be a source codeinterface that a computer system or program library provides in order tosupport requests for services from an application. An operating system(OS) can have multiple APIs to allow applications running on the OS tocall one or more of those APIs, and a service (such as a programlibrary) can have multiple APIs to allow an application that uses theservice to call one or more of those APIs. An API can be specified interms of a programming language that can be interpreted or compiled whenan application is built.

In some implementations, the API-implementing component may provide morethan one API, that provide access to different aspects of thefunctionality implemented by the API-implementing component. Forexample, one API of an API-implementing component can provide a firstset of functions and can be exposed to third party developers, andanother API of the API-implementing component can be hidden (notexposed) and provide a subset of the first set of functions and alsoprovide another set of functions, such as testing or debugging functionswhich are not in the first set of functions. In other implementations,the API-implementing component may itself call one or more othercomponents via an underlying API and thus be both an API-callingcomponent and an API-implementing component.

An API defines the language and parameters that API-calling componentsuse when accessing and using specified features of the API-implementingcomponent. For example, an API-calling component accesses the specifiedfeatures of the API-implementing component through one or more API callsor invocations (embodied for example by function or method calls)exposed by the API and passes data and control information usingparameters via the API calls or invocations. The API-implementingcomponent may return a value through the API in response to an API callfrom an API-calling component. While the API defines the syntax andresult of an API call (e.g., how to invoke the API call and what the APIcall does), the API may not reveal how the API call accomplishes thefunction specified by the API call. Various API calls are transferredvia the one or more application programming interfaces between thecalling (API-calling component) and an API-implementing component.Transferring the API calls may include issuing, initiating, invoking,calling, receiving, returning, or responding to the function calls ormessages; in other words, transferring can describe actions by either ofthe API-calling component or the API-implementing component. Thefunction calls or other invocations of the API may send or receive oneor more parameters through a parameter list or other structure. Aparameter can be a constant, key, data structure, object, object class,variable, data type, pointer, array, list or a pointer to a function ormethod or another way to reference a data or other item to be passed viathe API.

Furthermore, data types or classes may be provided by the API andimplemented by the API-implementing component. Thus, the API-callingcomponent may declare variables, use pointers to, use or instantiateconstant values of such types or classes by using definitions providedin the API.

Generally, an API can be used to access a service or data provided bythe API-implementing component or to initiate performance of anoperation or computation provided by the API-implementing component. Byway of example, the API-implementing component and the API-callingcomponent may each be any one of an operating system, a library, adevice driver, an API, an application program, or other module (e.g.,the API-implementing component and the API-calling component may be thesame or different type of module from each other). API-implementingcomponents may in some cases be embodied at least in part in firmware,microcode, or other hardware logic.

In some implementations, an API may allow a client program to use theservices provided by a Software Development Kit (SDK) library. In otherembodiments an application or other client program may use an APIprovided by an Application Framework. In these implementations, theapplication or client program may incorporate calls to functions ormethods provided by the SDK and/or provided by the API or use data typesor objects defined in the SDK and provided by the API. An ApplicationFramework may in these implementations provide a main event loop for aprogram that responds to various events defined by the Framework. TheAPI allows the application to specify the events and the responses tothe events using the Application Framework. In some implementations, anAPI call can report to an application the capabilities or state of ahardware device, including those related to aspects such as inputcapabilities and state, output capabilities and state, processingcapability, power state, storage capacity and state, communicationscapability, etc., and the API may be implemented in part by firmware,microcode, or other low level logic that executes in part on thehardware component.

The API-calling component may be a local component (e.g., on the samedata processing system as the API-implementing component) or a remotecomponent (e.g., on a different data processing system from theAPI-implementing component) that communicates with the API-implementingcomponent through the API over a network. An API-implementing componentmay also act as an API-calling component (e.g., it may make API calls toan API exposed by a different API-implementing component) and anAPI-calling component may also act as an API-implementing component byimplementing an API that is exposed to a different API-callingcomponent.

The API may allow multiple API-calling components written in differentprogramming languages to communicate with the API-implementingcomponent, thus the API may include features for translating calls andreturns between the API-implementing component and the API-callingcomponent. However the API may be implemented in terms of a specificprogramming language. An API-calling component can, in one embedment,call APIs from different providers such as a set of APIs from an OSprovider and another set of APIs from a plug-in provider and another setof APIs from another provider (e.g. the provider of a software library)or creator of the another set of APIs.

FIG. 5 is a block diagram illustrating an example API architecture 500,which can be used in some implementations. As shown in FIG. 5, the APIarchitecture 500 includes the API-implementing component 510 (e.g., anoperating system, a library, a device driver, an API, an applicationprogram, software or other module) that implements the API 520. The API520 can specify one or more functions, methods, classes, objects,protocols, data structures, formats and/or other features of theAPI-implementing component that may be used by the API-calling component530. The API 520 can specify at least one calling convention thatspecifies how a function in the API-implementing component receivesparameters 532 from the API-calling component and how the functionreturns a result 522 to the API-calling component. The API-callingcomponent 530 (e.g., an operating system, a library, a device driver, anAPI, an application program, software or other module), makes API callsthrough the API 520 to access and use the features of theAPI-implementing component 510 that are specified by the API 520. TheAPI-implementing component 510 may return a value through the API 520 tothe API-calling component 530 in response to an API call.

For example, the API-implementing component 510 can include additionalfunctions, methods, classes, data structures, and/or other features thatare not specified through the API 520 and are not available to theAPI-calling component 530. The API-calling component 530 may be on thesame system as the API-implementing component 510 or may be locatedremotely and accesses the API-implementing component 510 using the API520 over a network. While FIG. 5 illustrates a single API-callingcomponent 530 interacting with the API 520, other API-callingcomponents, which may be written in different languages (or the samelanguage) than the API-calling component 530, may use the API 520.

The API-implementing component 510, the API 520, and the API-callingcomponent 530 may be stored in a machine-readable medium, which includesany mechanism for storing information in a form readable by a machine(e.g., a computer or other data processing system). For example, amachine-readable medium includes magnetic disks, optical disks, randomaccess memory; read only memory, flash memory devices, etc.

FIG. 6 illustrates an example software stack 600 that includes variousapplication programming interfaces. As illustrated by FIG. 6,applications 602 and 604 can make calls to Service A 606 or Service B608 using several Service APIs 610-616 and to Operating System (OS) 618using several OS APIs 620-622. Service A 606 or Service B 608 can makecalls to OS using several OS APIs 620-622.

Note that the Service B 608 has two APIs 612 and 614, one of which,Service B API 1 612, receives calls from and returns values toApplication 1 602 and the other, Service B API 2 614, receives callsfrom and returns values to Application 2 604. Service A 606 (which canbe, for example, a software library) makes calls to and receivesreturned values from OS API 1 620, and Service B 622 (which can be, forexample, a software library) makes calls to and receives returned valuesfrom both OS API 1 620 and OS API 2 622. Application 2 604 makes callsto and receives returned values from OS API 2 622.

Example System Architecture

FIG. 7 is a block diagram of an example computing device 700 that canimplement the features and processes of FIGS. 1-6. The computing device700 can include a memory interface 702, one or more data processors,image processors and/or central processing units 704, and a peripheralsinterface 706. The memory interface 702, the one or more processors 704and/or the peripherals interface 706 can be separate components or canbe integrated in one or more integrated circuits. The various componentsin the computing device 700 can be coupled by one or more communicationbuses or signal lines.

Sensors, devices, and subsystems can be coupled to the peripheralsinterface 706 to facilitate multiple functionalities. For example, amotion sensor 710, a light sensor 712, and a proximity sensor 714 can becoupled to the peripherals interface 706 to facilitate orientation,lighting, and proximity functions. Other sensors 716 can also beconnected to the peripherals interface 706, such as a global navigationsatellite system (GNSS) (e.g., GPS receiver), a temperature sensor, abiometric sensor, magnetometer or other sensing device, to facilitaterelated functionalities.

A camera subsystem 720 and an optical sensor 722, e.g., a chargedcoupled device (CCD) or a complementary metal-oxide semiconductor (CMOS)optical sensor, can be utilized to facilitate camera functions, such asrecording photographs and video clips. The camera subsystem 720 and theoptical sensor 722 can be used to collect images of a user to be usedduring authentication of a user, e.g., by performing facial recognitionanalysis.

Communication functions can be facilitated through one or more wirelesscommunication subsystems 724, which can include radio frequencyreceivers and transmitters and/or optical (e.g., infrared) receivers andtransmitters. The specific design and implementation of thecommunication subsystem 724 can depend on the communication network(s)over which the computing device 700 is intended to operate. For example,the computing device 700 can include communication subsystems 724designed to operate over a GSM network, a GPRS network, an EDGE network,a Wi-Fi or WiMax network, and a Bluetooth™ network. In particular, thewireless communication subsystems 724 can include hosting protocols suchthat the device 100 can be configured as a base station for otherwireless devices.

An audio subsystem 726 can be coupled to a speaker 728 and a microphone730 to facilitate voice-enabled functions, such as speaker recognition,voice replication, digital recording, and telephony functions. The audiosubsystem 726 can be configured to facilitate processing voice commands,voiceprinting and voice authentication, for example.

The I/O subsystem 740 can include a touch-surface controller 742 and/orother input controller(s) 744. The touch-surface controller 742 can becoupled to a touch surface 746. The touch surface 746 and touch-surfacecontroller 742 can, for example, detect contact and motion or breakthereof using any of a plurality of touch sensitivity technologies,including but not limited to capacitive, resistive, infrared, andsurface acoustic wave technologies, as well as other proximity sensorarrays or other elements for determining one or more points of contactwith the touch surface 746.

The other input controller(s) 744 can be coupled to other input/controldevices 748, such as one or more buttons, rocker switches, thumb-wheel,infrared port, USB port, and/or a pointer device such as a stylus. Theone or more buttons (not shown) can include an up/down button for volumecontrol of the speaker 728 and/or the microphone 730.

In one implementation, a pressing of the button for a first duration candisengage a lock of the touch surface 746; and a pressing of the buttonfor a second duration that is longer than the first duration can turnpower to the computing device 700 on or off. Pressing the button for athird duration can activate a voice control, or voice command, modulethat enables the user to speak commands into the microphone 730 to causethe device to execute the spoken command. The user can customize afunctionality of one or more of the buttons. The touch surface 746 can,for example, also be used to implement virtual or soft buttons and/or akeyboard.

In some implementations, the computing device 700 can present recordedaudio and/or video files, such as MP3, AAC, and MPEG files. In someimplementations, the computing device 700 can include the functionalityof an MP3 player, such as an iPod™. Other input/output and controldevices can also be used.

The memory interface 702 can be coupled to memory 750. The memory 750can include high-speed random access memory and/or non-volatile memory,such as one or more magnetic disk storage devices, one or more opticalstorage devices, and/or flash memory (e.g., NAND, NOR). The memory 750can store an operating system 752, such as Darwin, RTXC, LINUX, UNIX, OSX, WINDOWS, or an embedded operating system such as VxWorks.

The operating system 752 can include instructions for handling basicsystem services and for performing hardware dependent tasks. In someimplementations, the operating system 752 can be a kernel (e.g., UNIXkernel). In some implementations, the operating system 752 can includeinstructions for performing motion fencing. For example, operatingsystem 752 can implement the motion fencing features as described withreference to FIGS. 1-6.

The memory 750 can also store communication instructions 754 tofacilitate communicating with one or more additional devices, one ormore computers and/or one or more servers. The memory 750 can includegraphical user interface instructions 756 to facilitate graphic userinterface processing; sensor processing instructions 758 to facilitatesensor-related processing and functions; phone instructions 760 tofacilitate phone-related processes and functions; electronic messaginginstructions 762 to facilitate electronic-messaging related processesand functions; web browsing instructions 764 to facilitate webbrowsing-related processes and functions; media processing instructions766 to facilitate media processing-related processes and functions;GNSS/Navigation instructions 768 to facilitate GNSS andnavigation-related processes and instructions; and/or camerainstructions 770 to facilitate camera-related processes and functions.

The memory 750 can store software instructions 772 to facilitate otherprocesses and functions, such as the motion fencing processes andfunctions as described with reference to FIGS. 1-6. For example,software instructions 772 can include instructions for determining thecurrent motion domain of the mobile device and notifying or invokingapplications based on the current motion domain.

The memory 750 can also store other software instructions 774, such asweb video instructions to facilitate web video-related processes andfunctions; and/or web shopping instructions to facilitate webshopping-related processes and functions. In some implementations, themedia processing instructions 766 are divided into audio processinginstructions and video processing instructions to facilitate audioprocessing-related processes and functions and video processing-relatedprocesses and functions, respectively.

Each of the above identified instructions and applications cancorrespond to a set of instructions for performing one or more functionsdescribed above. These instructions need not be implemented as separatesoftware programs, procedures, or modules. The memory 750 can includeadditional instructions or fewer instructions. Furthermore, variousfunctions of the computing device 700 can be implemented in hardwareand/or in software, including in one or more signal processing and/orapplication specific integrated circuits.

What is claimed is:
 1. A method comprising: receiving, by a motionfencing system of a mobile device and from a client component of themobile device, a request that, when motion of the mobile devicecorresponds to an activity specified in the request, the motion fencingsystem shall notify the client component; mapping, by the motion fencingsystem, the activity to a motion domain that is defined by at least oneof magnitude, duration, or frequency of the motion of the mobile device;determining, by the motion fencing system operating in a first powermode and using an amount of motions detected by a sensor, that themobile device is in the motion domain of the activity upon determiningthat the motion of the mobile device satisfies at least one of themagnitude, duration, or frequency of motion; upon determining that themobile device is in the motion domain, determining, by the motionfencing system in a second power mode and using patterns of motiondetected by a sensor, that the motion of the mobile device correspondsto the activity; and notifying the client component by the motionfencing system, including causing the client component to turn on orturn off one or more functions of the mobile device, wherein the motionfencing system includes a processor that is configured to recognize thepatterns, the processor being turned off in the first power mode andturned on in the second power mode.
 2. The method of claim 1, whereinthe activity corresponds to one or more motion patterns detected by themobile device, and determining that the motion of the mobile devicecorresponds to the activity comprises determining that the motion of themobile device corresponds to at least one of the one or more motionpatterns.
 3. The method of claim 2, wherein notifying the clientcomponent includes invoking one or more applications, functions, orutilities of the mobile device.
 4. The method of claim 1, whereinnotifying the client component comprises turning on one or morecomponents of the mobile device, the one or more components including amicroprocessor.
 5. The method of claim 1, wherein the motion comprisesone of: a static motion domain corresponding to zero amount of motion; asparse motion domain corresponding to a non-zero amount of motion; asustained motion domain corresponding to an amount of motion that hasbeen sustained for a period of time; and a rich motion domaincorresponding to an amount of motion that exceeds a threshold magnitude,or exceeds a threshold frequency, or both, for longer than a thresholdperiod of time.
 6. The method of claim 1, wherein notifying the clientcomponent comprises adjusting a power level of one or more components ofthe mobile device.
 7. A non-transitory computer-readable medium storingone or more sequences of instructions which, when executed by one ormore processors, cause the one or more processors to perform operationscomprising: receiving, by a motion fencing system of a mobile device andfrom a client component of the mobile device, a request that, whenmotion of the mobile device corresponds to an activity specified in therequest, the motion fencing system shall notify the client component;mapping, by the motion fencing system, the activity to a motion domainthat is defined by at least one of magnitude, duration, or frequency ofthe motion of the mobile device; determining, by the motion fencingsystem operating in a first power mode and using an amount of motionsdetected by a sensor, that the mobile device is in the motion domain ofthe activity upon determining that the motion of the mobile devicesatisfies at least one of the magnitude, duration, or frequency ofmotion; upon determining that the mobile device is in the motion domain,determining, by the motion fencing system in a second power mode andusing patterns of motion detected by a sensor, that the motion of themobile device corresponds to the activity; and notifying the clientcomponent by the motion fencing system, including causing the clientcomponent to turn on or turn off one or more functions of the mobiledevice, wherein the motion fencing system includes a processor that isconfigured to recognize the patterns, the processor being turned off inthe first power mode and turned on in the second power mode.
 8. Thenon-transitory computer-readable medium of claim 7, wherein the activitycorresponds to one or more motion patterns detected by the mobiledevice, and determining that the motion of the mobile device correspondsto the activity comprises determining that the motion of the mobiledevice corresponds to at least one of the one or more motion patterns.9. The non-transitory computer-readable medium of claim 8, whereinnotifying the one or more clients includes turning on one or morecomponents of the mobile device, the one or more components including amicroprocessor.
 10. The non-transitory computer-readable medium of claim7, the operations comprising, upon determining that the motion of themobile device corresponds to the activity, turning off one or morecomponents of the mobile device.
 11. The non-transitorycomputer-readable medium of claim 7, wherein the motion domain comprisesone of: a static motion domain corresponding to zero amount of motion; asparse motion domain corresponding to a non-zero amount of motion; asustained motion domain corresponding to an amount of motion that hasbeen sustained for a period of time; and a rich motion domaincorresponding to an amount of motion that exceeds a threshold magnitude,or exceeds a threshold frequency, or both, for longer than a thresholdperiod of time.
 12. The non-transitory computer-readable medium of claim10, the operations comprising, upon determining that the motion of themobile device that the motion of the mobile device corresponds to theactivity, adjusting a power level of one or more components of themobile device.
 13. A system comprising: one or more processors; and anon-transitory computer-readable medium storing one or more sequences ofinstructions which, when executed by the one or more processors, causethe one or more processors to perform operations comprising: receiving,by a motion fencing system of a mobile device and from a clientcomponent of the mobile device, a request that, when motion of themobile device corresponds to an activity specified in the request, themotion fencing system shall notify the client component; mapping, by themotion fencing system, the activity to a motion domain that is definedby at least one of magnitude, duration, or frequency of the motion ofthe mobile device; determining, by the motion fencing system operatingin a first power mode and using an amount of motions detected by asensor, that the mobile device is in the motion domain of the activityupon determining that the motion of the mobile device satisfies at leastone of the magnitude, duration, or frequency of motion; upon determiningthat the mobile device is in the motion domain, determining, by themotion fencing system in a second power mode and using patterns ofmotion detected by a sensor, that the motion of the mobile devicecorresponds to the activity; and notifying the client component by themotion fencing system, including causing the client component to turn onor turn off one or more functions of the mobile device, wherein themotion fencing system includes a processor that is configured torecognize the patterns, the processor being turned off in the firstpower mode and turned on in the second power mode.
 14. The system ofclaim 13, wherein the activity corresponds to one or more motionpatterns detected by the mobile device, and determining that the motionof the mobile device corresponds to the activity comprises determiningthat the motion of the mobile device corresponds to at least one of theone or more motion patterns.
 15. The system of claim 14, whereinnotifying the client component includes invoking one or more clients.16. The system of claim 13, the operations comprising, upon determiningthat the motion the mobile device corresponds to the activity, turningon one or more components of the mobile device.
 17. The system of claim16, wherein the motion domain comprise one of: a static motion domaincorresponding to zero amount of motion; a sparse motion domaincorresponding to a non-zero amount of motion; a sustained motion domaincorresponding to an amount of motion that has been sustained for aperiod of time; and a rich motion domain corresponding to an amount ofmotion that exceeds a threshold magnitude, or exceeds a thresholdfrequency, or both, for longer than a threshold period of time.
 18. Thesystem of claim 16, the operations comprising, upon determining that themotion of the mobile device corresponds to the activity, adjusting apower level of one or more components of the mobile device.